/* eslint-disable */
// @ts-ignore
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as API from './types';

/** 分页查询产品信息 GET /product */
export async function productGetProductPage({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductGetProductPageParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelResponseDataListModelProductModel_>(
    '/product',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 新增产品信息 POST /product */
export async function productAddProduct({
  body,
  options,
}: {
  body: API.AddOrEditProductModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除产品信息 DELETE /product */
export async function productDeleteProduct({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductDeleteProductParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查询产品信息详情 GET /product/${param0} */
export async function productGetProductDetails({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductGetProductDetailsParams;
  options?: CustomRequestOptions;
}) {
  const { id: param0, ...queryParams } = params;

  return request<API.ResponseModelProductModel_>(`/product/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 新增并提交审核产品信息 POST /product/add_submit */
export async function productAddAndSubmitProduct({
  body,
  options,
}: {
  body: API.AddOrEditProductModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product/add_submit', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 编辑产品信息 PUT /product/edit */
export async function productEditProduct({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductEditProductParams;
  body: API.AddOrEditProductModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product/edit', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: {
      ...params,
    },
    data: body,
    ...(options || {}),
  });
}

/** 编辑并提交审核产品信息 PUT /product/edit_submit */
export async function productEditAndSubmitProduct({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductEditAndSubmitProductParams;
  body: API.AddOrEditProductModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product/edit_submit', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: {
      ...params,
    },
    data: body,
    ...(options || {}),
  });
}

/** 提交审核产品信息 POST /product/submit */
export async function productSubmitProduct({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.ProductSubmitProductParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/product/submit', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
